package cn.wizzer.util;

import cn.wizzer.framework.base.Result;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * 公共类
 */
public class CommonUtil {

    /**
     * 校验手机号格式
     *
     * @param phone
     * @return
     */
    public static Boolean isPhone(String phone) {
        String req = "^1(?:3\\d|4[4-9]|5[0-35-9]|6[67]|7[013-8]|8\\d|9\\d)\\d{8}$";
        Matcher matcher = Pattern.compile(req).matcher(phone);
        if (!matcher.find()) {
            Result.breakWith("手机号码格式不正确");
        }
        return true;
    }

}
